package com.wswy.wzcx.ui.main.garage

import android.graphics.*
import com.blankj.utilcode.util.SizeUtils
import com.wswy.wzcx.widget.drawable.BaseDrawable

open class TipsContentDrawable(val color:Int) : BaseDrawable() {

    protected val rectF = RectF()

    private val path= Path()

    init {
        paint.color = color
        paint.style = Paint.Style.FILL
    }

    override fun onBoundsChange(bounds: Rect?) {
        super.onBoundsChange(bounds)

        rectF.set(bounds)

        val dp40 = SizeUtils.dp2px(40f).toFloat()

        path.reset()

        path.moveTo(0f,dp40)
        path.quadTo(rectF.centerX(),0f,rectF.width(),dp40)


        path.lineTo(rectF.width(),rectF.height())
        path.lineTo(0f,rectF.height())
        path.lineTo(0f,dp40)
        path.close()

    }

    override fun draw(canvas: Canvas?) {


        canvas?.drawPath(path, paint)

    }
}